package at.fhj.itm11.forum.gui;

import static org.junit.Assert.assertTrue;

import java.util.NoSuchElementException;

import org.junit.Test;
import org.openqa.selenium.By;

public class US02 extends AbstractGUITest {

  @Test
  public void testLogoutOK() throws Exception {
	  String userName = "fhj", password = "fhj";
	  login(userName, password);

	  driver.findElement(By.linkText("Ausloggen")).click();
	  assertTrue(isElementPresent(By.linkText("Einloggen")));
  }

private boolean isElementPresent(By by) {
    try {
      driver.findElement(by);
      return true;
    } catch (NoSuchElementException e) {
      return false;
    }
  }
}